import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Main from '../views/Main.vue'
const admin = () => import('../views/admin.vue');
const manage = () => import('../views/manage.vue');
const user = () => import('../views/user.vue');
const Login =() => import('../views/Login.vue')
Vue.use(VueRouter)

const routes = [
	{
		path: '/home',
		name: 'Home',
		component: Home,
		children: [
			{
				// main 会被渲染在 home 的 <router-view> 中
				path: 'main',
				component:	Main,
				name:'主页'
			},
			{
				path:'admin',
				component: admin,
				name:'admin'
			},
			{
				path:'manage',
				component: manage,
				name:'manage'
			  },
			  {
				path:'user',
				component: user,
				name:'user'
			  }
		]
	},
	{
	path: '/',
    name: 'Login',
    component:Login,
  },

]
const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})

export default router
